import React, { Component, Fragment } from 'react';
import { Link } from 'dva/router';
import { connect } from 'dva';
import router from 'umi/router';
import styles from './index.less';
import { Card, Switch, Input, Radio, Checkbox,Row, Col, Form, Button, message, Spin, Tag,Icon,Modal,TimePicker,Cascader } from 'antd';
import moment from 'moment';
const FormItem = Form.Item;
const RadioGroup = Radio.Group;
const weekdayArr=["周一","周二","周三","周四","周五","周六","周日"];
import regions from '../delivery/regionData';
import {
    generateTreeDataMap,
  } from '../delivery/tools';

let regionData=transformData(regions);
//console.log(regionData)
let regionDatas=[];
function transformData(data){
    let datas=data||[];
    datas.forEach((item,index)=>{
        item.value=item.Id;
        item.label=item.Name;
        item.children=item.Child;
        if(item.Child){
            transformData(item.Child)
        }
    })
    return datas;
}
const namespace = 'selfFetch';
@Form.create()
export default class Index extends Component {
    state={
        visible:false,
        searchLoading:false,
        hideSearchBox:true,
        reception:[{
          startTime:"",
          endTime:"",
          receptionDay:[],
          isSave:false
        }],
        showAdd:false,
        selectedArr:[],
        selectedArrClone:[],
        confirmLoading:false
    }

    componentWillMount(){
        window.Isoption = false;
      this.dataMap = generateTreeDataMap(regions, {}, -1);
        this.citycode="";
        //console.log(this.dataMap)
        let arr =[];
        regionData.forEach(item=>{
        if(item.children){
            item.children.forEach(v=>{
            arr.push(v)
            })
        }
        })
        regionDatas=arr;
    }

    componentDidMount(){
        window.Isoption = true;
        const {onRef} = this.props;
        onRef&&onRef(this);
    }

    hideModal = () => {
      const {form} = this.props;

      form.setFieldsValue({
        Name:"",
        ReceptionConfig:[
          {
            startTime:"",
            endTime:"",
            receptionDay:[],
            isSave:false
          }
        ],
        Region:[],
        RegionText:"",
        ContactTel:"",
        Enable:0
      })
      this.setState({
        visible:false,
        confirmLoading:false,
        selectedArr:[],
        selectedArrClone:[],
        reception:[{
          startTime:"",
          endTime:"",
          receptionDay:[],
          isSave:false
        }],
        showAdd:false,
        hideSearchBox:true
      },()=>{
        this.map.destroy();
      });
    }

    getIdByAreaCode = (id) => {
      let arr=[];
      // arr.push(this.dataMap[this.dataMap[this.dataMap[this.dataMap[id].Pid].Pid].Pid].Id)
      arr.push(this.dataMap[this.dataMap[this.dataMap[id].Pid].Pid].Id)
      arr.push(this.dataMap[this.dataMap[id].Pid].Id)
      arr.push(this.dataMap[id].Id)
      return arr;
    }

    settingArea = (data) => {
      console.log(data,22)
      let that=this;
      let areaCode= this.getIdByAreaCode(data[0].adcode);
      this.citycode=data[0].adcode;
      console.log(areaCode)
      let address=data[0].address;
      this.props.form.setFieldsValue({
          Region:areaCode,
          RegionText:address
      })
      this.map.clearMap();
      var marker = new AMap.Marker({
          map: this.map,
          position: [data[0].location.lng, data[0].location.lat],
      });
       //实例化信息窗体
      //var title = `<span>地址：</span>${address}`,
      var title = `<span>地址：</span>${address}`,
      content = [];
  // content.push("<a >设为联系地址</a>");
      var infoWindow = new AMap.InfoWindow({
          isCustom: true,  //使用自定义窗体
          content: that.createInfoWindow(that.map,title, content.join("<br/>"),1),
          offset: new AMap.Pixel(16, -5)
      });

      infoWindow.open(that.map, marker.getPosition());
      that.setState({
          hideSearchBox:true
      })
  }

  createInfoWindow = (map,title, content,type=2,data) => {
    let that=this;
    var info = document.createElement("div");
   info.className = "custom-info input-card content-window-card";
   info.style.width= "260px";
    //可以通过下面的方式修改自定义窗体的宽高
    // 定义顶部标题
    var top = document.createElement("div");
    var titleD = document.createElement("div");
    var closeX = document.createElement("img");
    closeX.style.position='absolute';
    closeX.style.top='8px';
    closeX.style.right='8px';
    top.className = "info-top";
    top.style.backgroundColor='white';
    titleD.innerHTML = title;
    titleD.style.lineHeight=1.4;
    closeX.src = "https://webapi.amap.com/images/close2.gif";
    closeX.onclick = function(){
        map.clearInfoWindow();
    };

    top.appendChild(titleD);
    top.appendChild(closeX);


    // 定义中部内容
    var middle = document.createElement("div");
    var a = document.createElement("a");
    middle.className = "info-middle";
    middle.style.backgroundColor = 'white';
    //middle.innerHTML = content;
    if(type==2){
        a.innerHTML="设为联系地址";
        a.onclick=function(){
            that.settingArea(data)
        }
        middle.appendChild(a);
    }
    info.appendChild(middle);

    //
    var box = document.createElement("div");
    box.style.padding="8px";
    box.style.paddingRight="16px";
    box.style.background= "#fff";
    info.style.boxSizing= "#border-box";
    box.style.border= "1px solid #ccc";
    box.appendChild(top);
    box.appendChild(middle);
    info.appendChild(box);
    // 定义底部内容
    var bottom = document.createElement("div");
    bottom.className = "info-bottom";
    bottom.style.position = 'relative';
    bottom.style.top = '-3px';
    bottom.style.margin = '0 auto';
    bottom.style.width = '30px';
    var sharp = document.createElement("img");
    sharp.src = "https://webapi.amap.com/images/sharp.png";
    bottom.appendChild(sharp);
    info.appendChild(bottom);
    return info;
}


    showModal = () => {
        let that=this;
        //console.log(this.state.reception)
        this.setState({
            visible:true
        },()=>{
            setTimeout(()=>{
                this.map = new AMap.Map('distributionModalMapContainer', {
                    //center:[116.46,39.92],
                    zoom:13
                });

                let scale = new AMap.Scale({
                  visible: true
                });
                let toolBar = new AMap.ToolBar({
                    visible: true
                });
                this.map.addControl(scale);
                this.map.addControl(toolBar);
                this.map.on('click', function(e){
                    var text = '您在 [ '+e.lnglat.getLng()+','+e.lnglat.getLat()+' ] 的位置单击了地图！';
                    console.log(e,text)
                    that.setState({
                        hideSearchBox:true
                    })
                    that.map.clearMap();
                    var marker = new AMap.Marker({
                        map: that.map,
                        position: [e.lnglat.getLng(), e.lnglat.getLat()],
                        // icon: 'https://webapi.amap.com/theme/v1.3/markers/n/mark_b' + (i + 1) + '.png',
                        // extData: {
                        //     id: i + 1
                        // }
                    });
                    AMap.service('AMap.Geocoder',function(){//回调函数
                        //实例化Geocoder
                        var geocoder = new AMap.Geocoder({
                            city: ""//城市，默认：“全国”
                        });
                        var lnglatXY=[e.lnglat.getLng(),e.lnglat.getLat()];//地图上所标点的坐标
                        geocoder.getAddress(lnglatXY, function(status, result) {
                            if (status === 'complete' && result.info === 'OK') {
                                //获得了有效的地址信息:
                                //即，result.regeocode.formattedAddress
                                //console.log(result);
                               // var city = result.regeocode.addressComponent.city;
                               that.setState({
                                   areaInfo:result.regeocode
                               })
                               let areaCode= that.getIdByAreaCode(result.regeocode.addressComponent.adcode);
                               that.citycode=result.regeocode.addressComponent.adcode;
                               console.log(areaCode)
                               let address=result.regeocode.formattedAddress;
                               that.props.form.setFieldsValue({
                                   Region:areaCode,
                                   RegionText:`${result.regeocode.addressComponent.township}${result.regeocode.addressComponent.street}${result.regeocode.addressComponent.streetNumber}`
                               })
                               //实例化信息窗体
                                //var title = `<span>地址：</span>${address}`,
                                let areaText=`${result.regeocode.addressComponent.province}${result.regeocode.addressComponent.city}${result.regeocode.addressComponent.district}${result.regeocode.addressComponent.township}${result.regeocode.addressComponent.street}${result.regeocode.addressComponent.streetNumber}`;
                                var title = `<span>地址：</span>${areaText}`,
                                content = [];
                            // content.push("<a >设为联系地址</a>");
                                var infoWindow = new AMap.InfoWindow({
                                    isCustom: true,  //使用自定义窗体
                                    content: that.createInfoWindow(that.map,title, content.join("<br/>"),1),
                                    offset: new AMap.Pixel(16, -5)
                                });

                                infoWindow.open(that.map, marker.getPosition());
                            }
                            console.log(result,999);
                        });
                    })
                    marker.on('click', function(){
                        console.log('marker',this)
                        console.log(that.map,AMap.Geocoder,AMap.Text([this.getPosition().lng,this.getPosition().lat]))
                        let _this=this;
                        AMap.service('AMap.Geocoder',function(){//回调函数
                            //实例化Geocoder
                            var geocoder = new AMap.Geocoder({
                                city: ""//城市，默认：“全国”
                            });
                            var lnglatXY=[_this.getPosition().lng,_this.getPosition().lat];//地图上所标点的坐标
                            geocoder.getAddress(lnglatXY, function(status, result) {
                                if (status === 'complete' && result.info === 'OK') {
                                    //获得了有效的地址信息:
                                    //即，result.regeocode.formattedAddress
                                    //console.log(result);
                                   // var city = result.regeocode.addressComponent.city;
                                //    that.props.form.setFieldsValue({
                                //     RegionText:`${result.regeocode.addressComponent.township}${result.regeocode.addressComponent.neighborhood}`
                                //    })
                                   let address=result.regeocode.formattedAddress;
                                   //实例化信息窗体
                                    var title = `<span>地址：</span>${address}`,
                                    content = [];
                                // content.push("<a >设为联系地址</a>");
                                    var infoWindow = new AMap.InfoWindow({
                                        isCustom: true,  //使用自定义窗体
                                        content: that.createInfoWindow(that.map,title, content.join("<br/>")),
                                        offset: new AMap.Pixel(16, -5)
                                    });

                                    infoWindow.open(that.map, _this.getPosition());
                                }else{
                                   // var city = '获取失败';
                                    //获取地址失败
                                }
                                //document.getElementById("city").value=city;
                                console.log(result,999);
                            });
                        })
                    });
                });
            },300)
            this.forceUpdate()
        })
    }

    areaChange = (value, selectedOptions) => {
      //console.log(value, selectedOptions,222)
      let text="";
      if(selectedOptions&&selectedOptions.length) selectedOptions.splice(0,1);
      selectedOptions.forEach(v=>{
          text+=v.Name;
      })
      this.props.form.setFieldsValue({
          RegionText:''
      })
      this.search(text)
  }

  searchArea = () => {
    const { form } = this.props;
    form.validateFields(['RegionText','Region'],(err,values)=>{
        //console.log(values)
        if(!values.Region){
            this.search(values.RegionText);
        }else{
            this.search(values.RegionText, this.citycode);
        };
    })
}

search = (text,citycode) => {
  if(!text&&!citycode) return;
  let that=this;
  this.setState({
      searchLoading:true,
  })

  AMap.service(["AMap.PlaceSearch"], function() {
      //构造地点查询类
      var placeSearch = new AMap.PlaceSearch({
          pageSize: 10, // 单页显示结果条数
          pageIndex: 1, // 页码
          city: `${citycode||''}`, // 兴趣点城市
          citylimit: true,  //是否强制限制在设置的城市内搜索
          map: that.map, // 展现结果的地图实例
          panel: "panel", // 结果列表将在此容器中进行展示。
          autoFitView: true // 是否自动调整地图视野使绘制的 Marker点都处于视口的可见范围
      });
      //关键字查询
      placeSearch.search(text,function(status,result){
          if(status === 'complete' && result.info === 'OK') {
              that.map.clearMap();
              let list = result.poiList.pois;
              for (var i = 0, marker; i < list.length; i++) {
                  var marker = new AMap.Marker({
                      position: [list[i].location.lng,list[i].location.lat],
                      icon: 'https://webapi.amap.com/theme/v1.3/markers/n/mark_b' + (i + 1) + '.png',
                      extData: {
                          id: i + 1
                      },
                      map: that.map
                  });
                 // marker.content = '我是第' + (i + 1) + '个Marker';
                  marker.on('click', function(){
                      let arr=result.poiList.pois.filter((item) => {
                          return item.location.lng===this.getPosition().lng&&item.location.lat===this.getPosition().lat;
                      });
                      //that.citycode=result.regeocode.addressComponent.adcode;
                      var title = `${arr[0].name}<br/><span>地址：</span>${arr[0].address}`,
                      content = [];
                      //content.push("<a >设为联系地址</a>");
                      var infoWindow = new AMap.InfoWindow({
                          isCustom: true,  //使用自定义窗体
                          content: that.createInfoWindow(that.map,title, content.join("<br/>"),2,arr),
                          offset: new AMap.Pixel(16, -5)
                      });

                      infoWindow.open(that.map, this.getPosition());
                      console.log(result,this.getPosition())
                  });
              }

          }
          //console.log(status,result)
          that.setState({
            searchLoading:false,
            hideSearchBox:false
          },()=>{
              document.querySelector('#panel .amap_lib_placeSearch_ul').onclick=function(e){
                  let index=document.querySelector('.poibox.selected .poibox-icon').innerHTML-1;
                  let item=result.poiList.pois[index];
                  //实例化信息窗体
                  var title = `${item.name}<br /><span>地址：</span>${item.address}`,
                  content = [];
              // content.push("<a >设为联系地址</a>");
                  var infoWindow = new AMap.InfoWindow({
                      isCustom: true,  //使用自定义窗体
                      content: that.createInfoWindow(that.map,title, content.join("<br/>"),2,[item]),
                      offset: new AMap.Pixel(16, -5)
                  });

                  infoWindow.open(that.map, item.location);
                  //console.log(item.location)
              }
          })
      });
  });
}


    selectWeekday = (index,day) => {

      let {reception,selectedArrClone}=this.state;
      const isSelect=selectedArrClone.indexOf(day);
      const hasIndex=reception[index].receptionDay.indexOf(day);
      if(hasIndex>-1){
        reception[index].receptionDay.splice(hasIndex,1)
      }else{
        reception[index].receptionDay.push(day)
      }
      if(isSelect>-1){
        selectedArrClone.splice(isSelect,1)
      }else{
        selectedArrClone.push(day);
      }
      this.setState({reception,selectedArrClone:JSON.parse(JSON.stringify(selectedArrClone))});

    }

    //确认1，取消2，编辑3，删除4
    operation = (index,type) => {
      const { form } = this.props;
      let {reception, selectedArrClone,selectedArr}=this.state;

      const item=reception[index];
      let showAdd=null;

      if(type===1){
        if(!item.startTime||!item.endTime){
          message.error("请选择时间间距");
          return;
        }
        let time1=item.startTime.split(":");
        let time2=item.endTime.split(":");
        time1.forEach((s,i)=>{
          time1[i]=Number(s)
        })
        time2.forEach((s,i)=>{
          time2[i]=Number(s)
        })
        if(time2[0]<time1[0]){
          message.error("小时结束时间必须大于开始时间");
          return;
        }else if(time2[0]==time1[0]){
          if(time2[1]<time1[1]){
            message.error("分钟结束时间必须大于开始时间");
            return;
          }else if(time2[1]==time1[1]){
            if(time2[2]<time1[2] || time2[2]==time1[2]){
              message.error("秒结束时间必须大于开始时间");
              return;
            }
          }
        }

        if(item.receptionDay.length===0){
          message.error("请选择星期");
          return;
        }
        item.isSave=true;
        if(selectedArrClone.length<7){
          showAdd=true;
        }else{
          showAdd=false;
        }

        this.setState({selectedArr:JSON.parse(JSON.stringify(selectedArrClone))});
      }else if(type===2){
        reception.splice(index,1);
        showAdd=true;
      }else if(type===3){
        item.isSave=false;
        showAdd=false;
      }else if(type===4){
        reception.splice(index,1);
        showAdd=true;
      }
      if(type===2||type===4){
        item.receptionDay.forEach(data=>{
          if(selectedArrClone.indexOf(data)>-1){
            selectedArrClone.splice(selectedArrClone.indexOf(data),1);
          }
        })
        this.setState({selectedArr:JSON.parse(JSON.stringify(selectedArrClone))});
      }else if(type===3){
        item.receptionDay.forEach(data=>{
          if(selectedArr.indexOf(data)>-1){
            selectedArr.splice(selectedArr.indexOf(data),1);
          }
        })
        this.setState({selectedArr:JSON.parse(JSON.stringify(selectedArr))});
      }
      //console.log(reception)
      //console.log(selectedArrClone)
      this.setState({reception,showAdd});
      form.setFieldsValue({
        ReceptionConfig:reception
      })
    }
    timePickerChange = (time,index,type) => {
      let {reception}=this.state;
      const item=reception[index];
      if(type===0){
        item.startTime=time
      }else{
        item.endTime=time
      }
      this.setState({reception});
    }
    addTimer = () => {
      let {reception}=this.state;
      let receptionItem={
        startTime:"",
        endTime:"",
        receptionDay:[],
        isSave:false
      }
      reception.push(receptionItem);
      this.setState({reception,showAdd:false});
    }

    onOk = () => {
      const { dispatch, form, getAddressList } = this.props;
      const {selectedArr,selectedArrClone,reception} = this.state;
      let notSave=reception.every((item)=>{return item.isSave});
      if(selectedArr.length<selectedArrClone.length || !notSave){
        form.setFields({
          ReceptionConfig: {
            errors: [new Error('请先保存时间段')],
          }
        })
      }

      form.validateFields((err, values) => {
        //console.log(values)

            if(err||!values.RegionText) return;
            this.setState({confirmLoading:true})
            let ProvId = values.Region[0];
            let CityId = values.Region[1];
            let DistrictId = values.Region[2];
            let type="marker";
            let overlays = this.map.getAllOverlays(type);
            let position = type == 'marker'? overlays[0].getPosition(): overlays[0].getPath()[0];
            let params={
                Prov:this.dataMap[ProvId].Name,
                ProvId:ProvId,
                City:this.dataMap[CityId].Name,
                CityId:CityId,
                District:this.dataMap[DistrictId].Name,
                DistrictId:DistrictId,
                Address:values.RegionText,
                Lng:position.lng,
                Lat:position.lat,
                Name:values.Name,
                Enable:values.Enable===1?true:false,
                ContactTel:values.ContactTel,
                ReceptionConfig:JSON.stringify(values.ReceptionConfig)
            }
            //console.log(params)
            dispatch({
              type: `${namespace}/AddPickupAddress`,
              payload: params,
              callBack: {
                success: (data) => {
                  message.success("新增成功").then(()=>{
                    this.hideModal();
                    getAddressList();
                  });
                },
                error: (data) => {
                  this.setState({confirmLoading:false});
                  message.error("新增失败：" + data.Msg);
                }
              }

            });
            //if(confirm && typeof confirm === 'function' ) confirm(params)
      })
    }

    render(){
      const formItemLayout2 = {
        labelCol: {
          xs: { span: 4 },
          sm: { span: 4 },
          md: { span: 4 },

        },
        wrapperCol: {
          xs: { span: 20 },
          sm: { span: 20 },
          md: { span: 20 },
        },
      };
        const { form: { getFieldDecorator } } = this.props;
        const { visible, reception, showAdd, selectedArr,searchLoading,hideSearchBox,confirmLoading } = this.state;
        //console.log(weekdayArr)
        const timeDom = (
          <div>
            {reception.map((item,index)=>{
              return <div key={index}>
                <TimePicker value={item.startTime?moment(`${item.startTime}`, 'HH:mm:ss'):null} disabled={item.isSave} onChange={(time,timeString)=>this.timePickerChange(timeString,index,0)}/> -
                <TimePicker value={item.endTime?moment(`${item.endTime}`, 'HH:mm:ss'):null}  disabled={item.isSave} onChange={(time,timeString)=>this.timePickerChange(timeString,index,1)}/>
                <div className={styles['weekDay']}>
                  {item.isSave?(<Fragment>
                    {item.receptionDay.map((day,i) =>{
                      return <span key={i} className={styles['dayItemSave']}>{day}</span>
                    })}
                  </Fragment>):
                  (<Fragment>
                    {weekdayArr.map((day,i) =>{
                      return <Fragment key={i}>
                          {selectedArr.indexOf(day)>-1?<span className={styles['dayItemDisable']}>{day}</span>:
                          <span
                          key={i}
                          onClick={()=>this.selectWeekday(index,day)}
                          className={(item.receptionDay).indexOf(day)>-1?`${styles['dayItem']} ${styles['dayItemSele']}`:`${styles['dayItem']}`}
                          >{day}</span>

                        }
                        </Fragment>
                    })}
                  </Fragment>)}
                  {item.isSave?<div style={{display:"inline-block"}}><a onClick={()=>this.operation(index,3)}>编辑</a><a  onClick={()=>this.operation(index,4)}>删除</a></div>:
                    <div style={{display:"inline-block"}}><a  onClick={()=>this.operation(index,1)}>确认</a><a  onClick={()=>this.operation(index,2)}>取消</a></div>}
                </div>
              </div>
            })}
          </div>
        );
        return(
            <Modal
              title={'新增自提地点'}
              width={850}
              visible={visible}
              onCancel={this.hideModal}
              onOk={this.onOk}
              centered
              confirmLoading={confirmLoading}
            >
                <Form>
                      <FormItem
                        //{...formItemLayout}
                        labelCol={{span:4}}
                        wrapperCol={{span:14}}
                        label="自提地点名称"
                      >
                        {getFieldDecorator('Name', {
                        rules: [{ required: true, message: '请填写自提点名称' }],
                        })(
                          <Input  placeholder="请填写自提点名称便于买家理解和管理"/>
                        )}

                    </FormItem>
                    <FormItem
                        //{...formItemLayout}
                        labelCol={{span:4}}
                        wrapperCol={{span:14}}
                        label="提货地址"
                    >
                        {getFieldDecorator('Region', {
                        rules: [{ required: true, message: '请选择提货地址' }],
                        })(
                            <Cascader expandTrigger="hover" options={regionDatas} placeholder="" onChange={this.areaChange}/>
                        )}

                    </FormItem>
                    <Row>
                        <Col offset={4} span={14}>
                            <FormItem
                               // {...formItemLayout}
                               style={{ marginBottom: 0 }}
                            >

                              {
                                  getFieldDecorator('RegionText')(
                                      <Input placeholder=""/>
                                  )
                              }
                            </FormItem>
                        </Col>
                        <Col span={4} style={{marginLeft:8}} className="xkd-text-left">
                            <FormItem>
                                <Button onClick={this.searchArea} loading={searchLoading}>搜索地图</Button>
                            </FormItem>
                        </Col>
                    </Row>
                    <FormItem
                        {...formItemLayout2}
                        label="地图定位"
                        // help={
                        //     <Fragment>
                        //         <div className="xkd-mt8">注：取货地址修改后，将影响您以下两点： </div>
                        //         <div>1.已设置的配送范围信息将被清空：请修改地址后记得重新配置配送范围</div>
                        //         <div>2.已开通的第三方配送都会重新审核，请准备3～7天审核期的其他配送方式；</div>
                        //     </Fragment>
                        // }
                    >
                        <div className={`${styles.mapContainer} xkd-position-relative ${hideSearchBox?'':styles.pullright}`} style={{overflow:'hidden'}}>
                            <div id="distributionModalMapContainer" style={{height:400}}></div>
                            <div style={{position:"absolute",top:0,left:0,zIndex:200,width:200,height:400,overflow:'hidden'}} className={`${hideSearchBox?styles.hideSearchBox:''}`}>
                                <div id="panel" style={{width:217,height:400,overflowY:'scroll',overflowX:'hidden'}}></div>
                            </div>
                        </div>
                    </FormItem>
                    <FormItem
                        //{...formItemLayout}
                        labelCol={{span:4}}
                        wrapperCol={{span:14}}
                        label="联系电话"
                      >
                        {getFieldDecorator('ContactTel', {
                        rules: [{ required: true, message: '请填写联系电话' }],
                        })(
                          <Input  placeholder="请填写联系电话"/>
                        )}

                    </FormItem>
                    <FormItem
                        //{...formItemLayout}
                        labelCol={{span:4}}
                        wrapperCol={{span:20}}
                        label="接待时间"
                      >
                        {getFieldDecorator('ReceptionConfig', {
                        rules: [{ required: true, message: '请填写并保存接待时间' }],
                        })(
                          <div>
                            {timeDom}
                            {showAdd?<a onClick={this.addTimer}>新增时间段</a>:null}
                          </div>

                        )}

                    </FormItem>
                    <FormItem
                        //{...formItemLayout}
                        labelCol={{span:4}}
                        wrapperCol={{span:14}}
                        label="状态"
                      >
                        {getFieldDecorator('Enable', {
                        rules: [{ required: true, message: '请填选择状态' }],
                        })(
                          <RadioGroup>
                            <Radio value={1}>启用</Radio>
                            <Radio value={2}>禁用</Radio>
                          </RadioGroup>
                        )}

                    </FormItem>
                </Form>
            </Modal>
        )
    }
}
